﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/static/include/top.jsp"%>
<form id="searchForm" name="searchForm" action="" method="get">
<input type="hidden" name="p" value="1" />
	<table>
		<tbody>
			<tr>
				<th><img src="${ctx}/static/images/pages/cen/rig/ico_01.png" align="absmiddle">&nbsp;填报</th>
			</tr>
			<tr class="tab_grey">
				<td>
				<span class="tab_text">填报单位名称：</span>
				<input id="chooseUser" name="chooseUser" type="hidden" readonly="readonly" value="${chooseUser}">
				<input class="tab_textbut" id="unitName" name="unitName" type="text" readonly="readonly" value="${unitName}" style="width:200px">
			<c:if test="${user.userLoginname=='jstjj'}">
				<img src="${ctx}/static/images/icons/ss1.gif" onclick="chooseUnit()" style="cursor:pointer"/>
				</c:if>
					<span class="tab_text">报表制度：</span>
					 <!-- onchange="getVersionList($('#reportSystem').val());" -->
					<select id="reportSystem" name="reportSystem" class="tab_textbut">
						<c:forEach var="system" items="${systemList}">
							<option value="${system.code}">${system.codeName}</option>
						</c:forEach>
					</select>
					填报日期： 
					 <!-- onchange="getReportTypeList($('#reportYear').val());" -->
				<input type="text" name="reportDate" id="reportDate" value="${reportDate}" size="20"  onfocus="WdatePicker({dateFmt:'yyyy-MM',minDate:'1995-01-01',maxDate:'%y-%M-%d'})" class="Wdate"/>
					
					<input type="submit" value="查询" class="tab_but" /> 
					<br/>
					<!--  <a class="tab_but02" href="#" onclick="">下载制度报表模板</a>-->
					<input type="button" class="tab_but"  onclick="reportExport();" value="下载模板" onfocus="this.blur()"/>
				    <input type="button" class="tab_but"  onclick="mutiImportWin();" value="批量导入"/>
					<input type="button" class="tab_but"  onclick="exportReport('${ctx}');" value="导出选中" onfocus="this.blur()"/>
		    		<input type="button" class="tab_but"  onclick="setSubmitFlag('${ctx}');" value="提交选中" onfocus="this.blur()"/>
		    		<input type="button" class="tab_but"  onclick="setDeleteFlag('${ctx}');" value="删除选中" onfocus="this.blur()"/>
					<!--		<font style="color:red">(批量导入需在文件名前补充报表时间和单位。代填单位需与系统中单位名称一致，日期格式为XXXX年X月第X季度，名称间以'_'间隔,示例如下：) </font>
	<br/>
	<font style="color:red">(年报：2014年_XXX单位_XXX报表。月报：2014年5月_XXX单位_XXX报表。季报：2014年5月第2季度_XXX单位_XXX报表) </font> -->
	
				</td>
			</tr>
		</tbody>
	</table>
</form>
<script>
//报表制度
$("#reportSystem").val("${param['reportSystem']}");
$("#reportVersion").val("${param['reportVersion']}");
$("#reportTypeCode").val("${param['reportTypeCode']}");
function clearInput() {
	$("#reportSystem").val("");
	$("#reportDate").val("");
}
function reportExport()
{
	var url="${ctx}/reports/service.do?method=downTemples&countyId=${user.id}";
	openWin("下载报表模板",url);
}
//查找直属单位
function chooseUnit(){
	openWin("查询单位","${baseURL}/company/unit/find",600,500,setValue);
}

function setValue(data) {
    document.getElementById("chooseUser").value = data.userId;
    document.getElementById("unitName").value = data.unitName;
}
//批量导入
function mutiImportWin()
{
	openWin("批量导入","${baseURL}/data/preMutiImport",500);
}
</script>

<c:if test="${empty obj.operationResult}">
	<b>没有符合条件的记录。</b>
</c:if>
<c:if test="${not empty obj.operationResult}">
<div style="height:400px; overflow-y:scroll;">
	<table id="listTable">
		<tbody>
			<tr>
				<th width="5%"><input type="checkbox" onclick="selectAll(this.checked);"></th>
				<th width="50%">报表名称</th>
				<th width="12%">操作</th>
			</tr>
			<c:forEach var="oneRow" items="${obj.operationResult}">
				<tr>
					<td><input name="chk" type="checkbox" id="chk" value="${oneRow.id}|${oneRow.reportCheckStatus}" /></td>
					<td align="left" >${oneRow.reportDomainName}</td>
					<td align="left" >
						<c:choose>
							<c:when test="${oneRow.id!=''}"><a href="#" class="tab_text01" onclick="openHistoryWin('${oneRow.id}');return false;">历史</a></c:when>
							<c:otherwise><a href="#" class="tab_text01" onclick="openImportWin('${unitId}','${oneRow.reportTypeId}','${oneRow.reportTimetype}','${oneRow.reportYearTime}','${oneRow.reportMonth}','${oneRow.reportQuarter}','${oneRow.status}');return false;">导入</a></c:otherwise>
						</c:choose>
					<c:choose>
					<c:when test="${oneRow.status==1}"><a href="#" class="tab_text01" onclick="openReportWin('${oneRow.userId}','${oneRow.reportTypeId}','${oneRow.reportTimetype}','${oneRow.reportUnitIndustry}','${oneRow.reportYearTime}','${oneRow.reportQuarter}','${oneRow.reportMonth}','${oneRow.status}');return false;">填报</a></c:when>
					<c:when test="${oneRow.status==2}"><a href="#" class="tab_text01" onclick="openReportWin('${oneRow.userId}','${oneRow.reportTypeId}','${oneRow.reportTimetype}','${oneRow.reportUnitIndustry}','${oneRow.reportYearTime}','${oneRow.reportQuarter}','${oneRow.reportMonth}','${oneRow.status}');return false;">迟报</a></c:when>
					<c:when test="${oneRow.status==3}"><a href="#" class="tab_text01" onclick="openEditWin('${oneRow.id}');return false;">修改</a></c:when>
					<c:when test="${oneRow.status==4}"><a href="#" class="tab_text01" onclick="openViewWin('${oneRow.id}');return false;">查看</a></c:when>
						</c:choose>
					</td>
				</tr>
			</c:forEach>
		
		</tbody>
	</table>
	</div>
	<script>
	function selectAll(checkAllFlag) {
		var checkArray = document.getElementsByName("chk");
		for (var i = 0; i < checkArray.length; i++) {
			checkArray[i].checked = checkAllFlag;
		}
	}
	
	//导入
	function openImportWin(unitId,reportTypeId,reportTimetype,reportYearTime,reportMonth,reportQuarter,status){
		var url="${ctx}/data/preImport?unitId="+unitId+"&reportProxyId=${user.id}&reportTypeId="+reportTypeId+
			"&timeType=" + reportTimetype + "&yearType=" + reportYearTime + "&quarterDate=" +
			reportQuarter + "&timeDate=" + reportMonth+"&status="+status;
		openWin("导入报表",url,null,200,reSubmit);
	}
	
	//查看历史窗口
	function openHistoryWin(id){
		var url="${ctx}/data/view?id="+id;
		openWin("审核历史",url);
	}
	
	//查看
	function openViewWin(id){
		var url="${ctx}/reports/service.do?method=showReportInfo&reportOperatorId=${user.id}&reportId="+id;
		openWin("查看报表",url,null,550);
	}
	
	//填报
	function openReportWin(userId,reportTypeId,reportTimetype,reportUnitIndustry,reportYearTime,reportQuarter,reportMonth,status){
		var date=$("#reportDate").val();
		var url="${ctx}/reports/service.do?method=showCreateReport&reportOperatorId="+userId+"&reportProxyId=${user.id}&reportTypeId="+reportTypeId+
		"&timeType=" + reportTimetype + "&unitIndustryId=" + reportUnitIndustry + "&yearType=" + reportYearTime + "&quarterDate=" +
		reportQuarter + "&reportVersion=" + 1 + "&timeDate=" + reportMonth+"&status="+status;
		openWin("报表填报",url,null,550,reSubmit);
	}

	//修改
	function openEditWin(id){
		var url="${ctx}/reports/service.do?method=showReportUpdate&reportOperatorId=${user.id}&reportId="+id;
		openWin("修改报表",url,null,550,reSubmit);
	}
	//重新提交表单
	function reSubmit(){
		document.searchForm.submit();
	}
	</script>
	<form action="${ctx}/report/exportReport" method="post" id="exportForm">
		<input type="hidden" name="idStr" id="exportIdStr"/>
	</form>
	<script src="${ctx}/static/ocean/js/listReport.js"></script>
	<script src="${ctx}/static/js/common-report.js"></script>
</c:if>

<%@ include file="/static/include/bottom.jsp"%>
